/*河南星辰软件科技有限公司
@copyright Copyright (c) 2010~2022 All rights reserved.
*/
package cn.javaxc.mes.action.main;
import java.io.*;
import java.util.*;
import java.sql.*;
import cn.javaxc.model.base.SQL;
import cn.javaxc.model.base.SQLList;
import cn.javaxc.model.base.SQLMap;
import cn.javaxc.model.base.SQLParam;
import cn.javaxc.model.page.BatisPage;
import cn.javaxc.mvcwork.controller.web.TreeBean;
import cn.javaxc.mvcwork.util.common.CommonUtil;
import cn.javaxc.mvcwork.util.common.MapListUtil;
import cn.javaxc.mvcwork.util.helper.FrameHelper;
import cn.javaxc.mvcwork.util.helper.TreeTableHelper;
import org.springframework.beans.factory.annotation.Autowired;
import cn.javaxc.system.action.base.BaseAction;
import cn.javaxc.talent.util.data.PdfUtil;
import cn.javaxc.talent.util.data.*;
import cn.javaxc.mes.mapper.main.RecordMapper;
public class RecordAction extends BaseAction
{
    @Autowired(required=false)
	private RecordMapper mapper;
    /**
    记录列表
    */
    
    public Map recordListSys() {
        
        Map result=new HashMap();
        SQLParam params=new SQLParam(request,result);
        TreeBean tb;
        
        tb = createTreeBean("s_menu_treecols");
        tb.setPrefix("img");
        tb.setTableNodeUrl("url");
        SQLList<SQLMap> s_menu=mapper.s_menu(params);
        s_menu = s_menu.buildTree(tb,tb.getPid());
        result.put("s_menu", s_menu);
        
        return result;
    }
    /**
    设备记录列表
    */
    
    public Map deviceRecord() {
        
        Map result=new HashMap();
        SQLParam params=new SQLParam(request,result);
        
        result.put("s_search", pagination.getSearchParas());
        
        
        SQLList<SQLMap> l_product=mapper.l_product(params,pagination);
        l_product.setPagedListInfo(pagination);
        result.put("l_product", l_product);
        
        return result;
    }
    /**
    工艺工序
    */
    
    public Map technologicalProcess() {
        
        Map result=new HashMap();
        SQLParam params=new SQLParam(request,result);
        
        result.put("s_search", pagination.getSearchParas());
        
        
        SQLList<SQLMap> l_product=mapper.l_product(params,pagination);
        l_product.setPagedListInfo(pagination);
        result.put("l_product", l_product);
        
        return result;
    }
    /**
    产品记录列表
    */
    
    public Map productRecordsSys() {
        
        Map result=new HashMap();
        SQLParam params=new SQLParam(request,result);
        
        result.put("s_search", pagination.getSearchParas());
        
        
        SQLList<SQLMap> l_product=mapper.l_product(params,pagination);
        l_product.setPagedListInfo(pagination);
        result.put("l_product", l_product);
        
        return result;
    }
    /**
    质量记录明细
    */
    
    public Map detailedQualitySys() {
        
        Map result=new HashMap();
        SQLParam params=new SQLParam(request,result);
        
        SQLList<SQLMap> s_record_work=mapper.s_record_work(params);
        SQLMap s_record_work_emt=s_record_work.getExistfirst();
        result.put("s_record_work", s_record_work_emt);
        
        
        SQLList<SQLMap> record=mapper.record(params);
        result.put("record", record);
        
        return result;
    }
    /**
    产品记录明细
    */
    
    public Map detailedProductSys() {
        
        Map result=new HashMap();
        SQLParam params=new SQLParam(request,result);
        
        SQLList<SQLMap> s_record_work=mapper.s_record_work(params);
        SQLMap s_record_work_emt=s_record_work.getExistfirst();
        result.put("s_record_work", s_record_work_emt);
        
        
        SQLList<SQLMap> record=mapper.record(params);
        result.put("record", record);
        
        return result;
    }
    /**
    工序记录明细
    */
    
    public Map detailedProcedureSys() {
        
        Map result=new HashMap();
        SQLParam params=new SQLParam(request,result);
        
        SQLList<SQLMap> s_record_work=mapper.s_record_work(params);
        SQLMap s_record_work_emt=s_record_work.getExistfirst();
        result.put("s_record_work", s_record_work_emt);
        
        
        SQLList<SQLMap> record=mapper.record(params);
        result.put("record", record);
        
        return result;
    }
    /**
    记录管理
    */
    
    public Map recordManagementSys() {
        
        Map result=new HashMap();
        SQLParam params=new SQLParam(request,result);
        TreeBean tb;
        
        tb = createTreeBean("s_menu_treecols");
        tb.setPrefix("img");
        tb.setTableNodeUrl("url");
        SQLList<SQLMap> s_menu=mapper.s_menu(params);
        s_menu = s_menu.buildTree(tb,tb.getPid());
        result.put("s_menu", s_menu);
        
        return result;
    }
    /**
    记录表格
    */
    
    public Map recordFormSys() {
        
        Map result=new HashMap();
        SQLParam params=new SQLParam(request,result);
        
        SQLList<SQLMap> s_table=mapper.s_table(params);
        result.put("s_table", s_table);
        
        return result;
    }
    /**
    格式明细
    */
    
    public Map detRecordFormsys() {
        
        Map result=new HashMap();
        SQLParam params=new SQLParam(request,result);
        
        SQLList<SQLMap> s_record_table=mapper.s_record_table(params);
        SQLMap s_record_table_emt=s_record_table.getExistfirst();
        result.put("s_record_table", s_record_table_emt);
        
        return result;
    }
    /**
    修改格式
    */
    
    public Map upRecordFormsys() {
        
        Map result=new HashMap();
        SQLParam params=new SQLParam(request,result);
        
        SQLList<SQLMap> s_record_table=mapper.s_record_table(params);
        SQLMap s_record_table_emt=s_record_table.getExistfirst();
        result.put("s_record_table", s_record_table_emt);
        
        return result;
    }
    /**
    设备表格
    */
    
    public Map equipmentFormSys() {
        
        Map result=new HashMap();
        SQLParam params=new SQLParam(request,result);
        
        result.put("s_search", pagination.getSearchParas());
        
        
        SQLList<SQLMap> l_table=mapper.l_table(params,pagination);
        l_table.setPagedListInfo(pagination);
        result.put("l_table", l_table);
        
        return result;
    }
    /**
    格式明细
    */
    
    public Map formatDetailsSys() {
        
        Map result=new HashMap();
        SQLParam params=new SQLParam(request,result);
        
        SQLList<SQLMap> s_record_table=mapper.s_record_table(params);
        SQLMap s_record_table_emt=s_record_table.getExistfirst();
        result.put("s_record_table", s_record_table_emt);
        
        return result;
    }
    /**
    */
    
    public Map d_work() {
        
        Map result=new HashMap();
        SQLParam params=new SQLParam(request,result);
        
        mapper.d_work(params);
        
        return result;
    }
    /**
    */
    
    public Map onInsertFile() {
        
        Map result=new HashMap();
        SQLParam params=new SQLParam(request,result);
        
        Object name =
        mapper.name(params);
        result.put("name", name);
        
        
        PdfUtil.writePdfContext(context,name+".pdf");
        
        return result;
    }
    /**
    增加记录修改
    */
    
    public Map addRecordFormsysSubmit() {
        
        Map result=new HashMap();
        SQLParam params=new SQLParam(request,result);
        
        int CMIDrecord_table_id = mapper.CMIDrecord_table_id(params);
        result.put("CMIDrecord_table_id", CMIDrecord_table_id);
        
        
        SQLList<SQLMap> s_table=mapper.s_table(params);
        SQLMap s_table_emt=s_table.getExistfirst();
        result.put("s_table", s_table_emt);
        
        
        TreeTableHelper.saveRecordJsp(context,s_table.getExistfirst().getString("record_content"),s_table.getExistfirst().getString("record_table_sid"));
        
        return result;
    }
    /**
    修改格式修改
    */
    
    public Map upRecordFormsysSubmit() {
        
        Map result=new HashMap();
        SQLParam params=new SQLParam(request,result);
        
        params.put("record_content",TreeTableHelper.buildRecordText(getParameter("record_content")));
        mapper.upRecordFormsysSubmit(params);
        
        
        SQLList<SQLMap> s_table=mapper.s_table(params);
        SQLMap s_table_emt=s_table.getExistfirst();
        result.put("s_table", s_table_emt);
        
        
        TreeTableHelper.saveRecordJsp(context,s_table.getExistfirst().getString("record_content"),s_table.getExistfirst().getString("record_table_sid"));
        
        return result;
    }
    /**
    */
    
    public Map preview() {
        
        Map result=new HashMap();
        SQLParam params=new SQLParam(request,result);
        return result;
    }
}